function A() {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log('A');
            resolve('success A')
        }, 1000)
    })
}
function B() {
    console.log('B');
}
function* foo(x) {
    let a = yield A()//a拿不到A的结果（promise对象），要通过下一个next（参数）中的参数才能获取
    console.log(a);
    yield B()

}
const it = foo(5)
// console.log(it.next(),'next1');//{ value: Promise { <pending> }, done: false }
// console.log(it.next(),'next2');//{ value: undefined, done: false } next2
// console.log(it.next(),'next3');//{ value: undefined, done: true } next3
it.next().value.then((res) => {
    console.log(res)
    console.log(it.next());
})

